package dao;

import hbt.HibernateDAO;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import bean.LocalBean;

public class LocalDao {
	
	
	public void altaLocal(LocalBean LB)
	{
		Session s = HibernateDAO.getInstancia().getSession();
		Transaction t = s.beginTransaction();
		s.persist(LB);
		t.commit();
	}

	@SuppressWarnings("unchecked")
	public List<LocalBean> listarLocalesDisponibles()
	{
		Session s = HibernateDAO.getInstancia().getSession();
		Transaction t = s.beginTransaction();
		List<LocalBean> locales = s.createQuery("SELECT L FROM LocalBean L").list();
		t.commit();
		return locales;
		
	}
}
